People counts, one full week, 15min intervals
Zero counts on Chancellors from 2016-08-18 10:15:00 to 2016-08-18 12:00:00
green_bridge, pedestrians, outbound massive outliers:
2016-08-20 07:30:00 137
2016-08-20 07:45:00 265
Frequency of counts from one week
campus_inbound_poi <- fitdist(campus_inbound$count, "pois")
campus_inbound_nb <- fitdist(campus_inbound$count, "nbinom")
par(mfrow = c(1,2))
denscomp(list(campus_inbound_poi, campus_inbound_nb), legendtext = c("Poisson", "negative binomial"), fitlty = 1)
cdfcomp(list(campus_inbound_poi, campus_inbound_nb), legendtext = c("Poisson", "negative binomial"), fitlty = 1)# gofstat(list(campus_inbound_poi, campus_inbound_nb), fitnames = c("Poisson", "negative binomial"))Modelling inbound traffic
# ####
# Jeffreys prior
a1 <- 5e-5
b1 <- 5e-5
lgprior1 <- list(prec = list(param = c(a1, b1)))
# Gelman prior
a2 <- -0.5
b2 <- 5e-5
lgprior2 <- list(prec = list(param = c(a2, b2)))
# iid prior
# Schrödle & Held 2010 & Blangiardo et al 2013
a0 <- 1
b0 <- 0.1
prior.nu <- list(prec = list(param = c(a0, b0)))
# intercept & fixed
inla.set.control.fixed.default() $cdf
NULL
$quantiles
NULL
$expand.factor.strategy
[1] "model.matrix"
$mean
[1] 0
$mean.intercept
[1] 0
$prec
[1] 0.001
$prec.intercept
[1] 0
$compute
[1] TRUE
$correlation.matrix
[1] FALSE
$remove.names
NULL
# intercept ~ N(0,0)
# other fixed effects ~ N(0, 0.001)
#
# where the format is N(mean, precision)
# precision = inverse of the variance.
# PC prior
U <- 1
hyper.prec = list(theta = list(
prior = "pc.prec",
param = c(U, 0.01)
))
# back to factor for regs
campus_inbound$site_type <- as.character(interaction(campus_inbound$type, campus_inbound$site, drop = TRUE, sep = " "))
campus_outbound$site_type <- as.character(interaction(campus_outbound$type, campus_outbound$site, drop = TRUE, sep = " "))
levels(campus_inbound$site_type)NULL
mod1 <- inla(count ~ site_type +
f(time, model = "rw1", scale.model = TRUE, hyper = hyper.prec),
family = "nbinomial",
control.compute = list(dic= TRUE, waic = TRUE),
data = campus_inbound)summary(mod1)
Call:
c("inla.core(formula = formula, family = family, contrasts = contrasts,
", " data = data, quantiles = quantiles, E = E, offset = offset, ", "
scale = scale, weights = weights, Ntrials = Ntrials, strata = strata,
", " lp.scale = lp.scale, link.covariates = link.covariates, verbose =
verbose, ", " lincomb = lincomb, selection = selection, control.compute
= control.compute, ", " control.predictor = control.predictor,
control.family = control.family, ", " control.inla = control.inla,
control.fixed = control.fixed, ", " control.mode = control.mode,
control.expert = control.expert, ", " control.hazard = control.hazard,
control.lincomb = control.lincomb, ", " control.update =
control.update, control.lp.scale = control.lp.scale, ", "
control.pardiso = control.pardiso, only.hyperparam = only.hyperparam,
", " inla.call = inla.call, inla.arg = inla.arg, num.threads =
num.threads, ", " blas.num.threads = blas.num.threads, keep = keep,
working.directory = working.directory, ", " silent = silent, inla.mode
= inla.mode, safe = FALSE, debug = debug, ", " .parent.frame =
.parent.frame)")
Time used:
Pre = 0.777, Running = 5.24, Post = 0.318, Total = 6.34
Fixed effects:
mean sd 0.025quant 0.5quant 0.975quant
(Intercept) 1.325 0.036 1.255 1.325 1.396
site_typecyclists Macquarie -0.635 0.051 -0.736 -0.635 -0.534
site_typepedestrians green_bridge 0.380 0.048 0.285 0.380 0.474
site_typepublic_transport ferry -0.514 0.051 -0.615 -0.514 -0.413
site_typepublic_transport lakes 1.461 0.047 1.369 1.461 1.553
site_typepublic_transport uq 1.239 0.047 1.147 1.240 1.332
site_typevehicles Chancellors 1.347 0.049 1.252 1.347 1.442
site_typevehicles McGregor 1.995 0.047 1.902 1.995 2.088
site_typevehicles Schonell 2.804 0.046 2.714 2.804 2.895
mode kld
(Intercept) 1.325 0
site_typecyclists Macquarie -0.635 0
site_typepedestrians green_bridge 0.380 0
site_typepublic_transport ferry -0.514 0
site_typepublic_transport lakes 1.461 0
site_typepublic_transport uq 1.240 0
site_typevehicles Chancellors 1.347 0
site_typevehicles McGregor 1.995 0
site_typevehicles Schonell 2.804 0
Random effects:
Name Model
time RW1 model
Model hyperparameters:
mean sd 0.025quant
size for the nbinomial observations (1/overdispersion) 1.97 0.052 1.87
Precision for time 0.13 0.011 0.11
0.5quant 0.975quant mode
size for the nbinomial observations (1/overdispersion) 1.97 2.078 1.97
Precision for time 0.13 0.153 0.13
Deviance Information Criterion (DIC) ...............: 40663.92
Deviance Information Criterion (DIC, saturated) ....: 35626.90
Effective number of parameters .....................: 301.65
Watanabe-Akaike information criterion (WAIC) ...: 40691.12
Effective number of parameters .................: 301.55
Marginal log-Likelihood: -22121.55
is computed
Posterior summaries for the linear predictor and the fitted values are computed
(Posterior marginals needs also 'control.compute=list(return.marginals.predictor=TRUE)')
autoplot(mod1)P1 <- bind_cols(time = campus_inbound$time, count = campus_inbound$count, site_type = campus_inbound$site_type,
fit = mod1$summary.fitted.values$`0.5quant`,
lci = mod1$summary.fitted.values$`0.025quant`,
uci = mod1$summary.fitted.values$`0.975quant`)
ggplot(P1, aes(x = time)) +
geom_line(aes(y = count), colour = "orange", alpha = 0.5) +
geom_line(aes(y = fit), col = "purple") +
geom_ribbon(aes(ymin = lci, ymax = uci), alpha = 0.3) +
facet_wrap(~site_type) +
theme_minimal() + xlab("") P1 %>%
filter(site_type == "public_transport lakes") %>%
ggplot(aes(x = time)) +
geom_point(aes(y = count), colour = "orange", size = 2, alpha = 0.5) +
geom_line(aes(y = fit), col = "purple") +
facet_wrap(~site_type) +
theme_minimal() + xlab("") ggplot(P1, aes(x = count, y = fit)) +
geom_point(alpha = 0.5) +
facet_wrap(~site_type) +
theme_minimal() + xlab("Counts") + ylab("fitted") inla.setOption(scale.model.default = TRUE)
campus_inbound$cyclists <- as.numeric(campus_inbound$type == "cyclists")
campus_inbound$pedestrians <- as.numeric(campus_inbound$type == "pedestrians")
campus_inbound$public_transport <- as.numeric(campus_inbound$type == "public_transport")
campus_inbound$vehicles <- as.numeric(campus_inbound$type == "vehicles")
campus_inbound$time2 <- campus_inbound$time
campus_inbound$time3 <- campus_inbound$time
campus_inbound$time4 <- campus_inbound$time
mod2 <- inla(count ~ site_type +
f(time, cyclists, model = "rw1", hyper = hyper.prec) +
f(time2, pedestrians, model = "rw1", hyper = hyper.prec) +
f(time3, public_transport, model = "rw1", hyper = hyper.prec) +
f(time4, vehicles, model = "rw1", hyper = hyper.prec),
family = "nbinomial",
control.compute = list(dic= TRUE, waic = TRUE),
data = campus_inbound)summary(mod2)
Call:
c("inla.core(formula = formula, family = family, contrasts = contrasts,
", " data = data, quantiles = quantiles, E = E, offset = offset, ", "
scale = scale, weights = weights, Ntrials = Ntrials, strata = strata,
", " lp.scale = lp.scale, link.covariates = link.covariates, verbose =
verbose, ", " lincomb = lincomb, selection = selection, control.compute
= control.compute, ", " control.predictor = control.predictor,
control.family = control.family, ", " control.inla = control.inla,
control.fixed = control.fixed, ", " control.mode = control.mode,
control.expert = control.expert, ", " control.hazard = control.hazard,
control.lincomb = control.lincomb, ", " control.update =
control.update, control.lp.scale = control.lp.scale, ", "
control.pardiso = control.pardiso, only.hyperparam = only.hyperparam,
", " inla.call = inla.call, inla.arg = inla.arg, num.threads =
num.threads, ", " blas.num.threads = blas.num.threads, keep = keep,
working.directory = working.directory, ", " silent = silent, inla.mode
= inla.mode, safe = FALSE, debug = debug, ", " .parent.frame =
.parent.frame)")
Time used:
Pre = 0.671, Running = 9.23, Post = 0.63, Total = 10.5
Fixed effects:
mean sd 0.025quant 0.5quant 0.975quant
(Intercept) 1.072 0.042 0.987 1.072 1.152
site_typecyclists Macquarie -0.641 0.037 -0.713 -0.641 -0.570
site_typepedestrians green_bridge 0.565 0.056 0.456 0.565 0.675
site_typepublic_transport ferry -1.300 0.075 -1.451 -1.299 -1.157
site_typepublic_transport lakes 0.786 0.071 0.644 0.788 0.921
site_typepublic_transport uq 0.601 0.071 0.458 0.603 0.737
site_typevehicles Chancellors 1.523 0.047 1.433 1.522 1.616
site_typevehicles McGregor 2.198 0.046 2.110 2.198 2.290
site_typevehicles Schonell 3.047 0.045 2.960 3.047 3.138
mode kld
(Intercept) 1.074 0
site_typecyclists Macquarie -0.641 0
site_typepedestrians green_bridge 0.565 0
site_typepublic_transport ferry -1.297 0
site_typepublic_transport lakes 0.790 0
site_typepublic_transport uq 0.605 0
site_typevehicles Chancellors 1.521 0
site_typevehicles McGregor 2.197 0
site_typevehicles Schonell 3.046 0
Random effects:
Name Model
time RW1 model
time2 RW1 model
time3 RW1 model
time4 RW1 model
Model hyperparameters:
mean sd 0.025quant
size for the nbinomial observations (1/overdispersion) 6.327 0.238 5.877
Precision for time 0.083 0.009 0.067
Precision for time2 0.094 0.010 0.075
Precision for time3 0.032 0.003 0.026
Precision for time4 0.187 0.016 0.157
0.5quant 0.975quant
size for the nbinomial observations (1/overdispersion) 6.320 6.813
Precision for time 0.083 0.102
Precision for time2 0.094 0.115
Precision for time3 0.032 0.038
Precision for time4 0.186 0.221
mode
size for the nbinomial observations (1/overdispersion) 6.303
Precision for time 0.083
Precision for time2 0.093
Precision for time3 0.032
Precision for time4 0.185
Deviance Information Criterion (DIC) ...............: 36857.41
Deviance Information Criterion (DIC, saturated) ....: 31820.40
Effective number of parameters .....................: 1002.69
Watanabe-Akaike information criterion (WAIC) ...: 36968.70
Effective number of parameters .................: 951.25
Marginal log-Likelihood: -25372.16
is computed
Posterior summaries for the linear predictor and the fitted values are computed
(Posterior marginals needs also 'control.compute=list(return.marginals.predictor=TRUE)')
autoplot(mod2)P2 <- bind_cols(time = campus_inbound$time, count = campus_inbound$count, site_type = campus_inbound$site_type,
fit = mod2$summary.fitted.values$`0.5quant`,
lci = mod2$summary.fitted.values$`0.025quant`,
uci = mod2$summary.fitted.values$`0.975quant`)
ggplot(P2, aes(x = time)) +
geom_line(aes(y = count), colour = "orange", alpha = 0.5) +
geom_line(aes(y = fit), col = "purple") +
geom_ribbon(aes(ymin = lci, ymax = uci), alpha = 0.3) +
facet_wrap(~site_type) +
theme_minimal() + xlab("") P2 %>%
filter(site_type == "public_transport lakes") %>%
ggplot(aes(x = time)) +
geom_point(aes(y = count), colour = "orange", size = 2, alpha = 0.5) +
geom_line(aes(y = fit), col = "purple") +
facet_wrap(~site_type) +
theme_minimal() + xlab("") ggplot(P2, aes(x = count, y = fit)) +
geom_point(alpha = 0.5) +
facet_wrap(~site_type) +
theme_minimal() + xlab("Counts") + ylab("fitted")campus_inbound$Chancellors <- as.numeric(campus_inbound$site == "Chancellors")
campus_inbound$ferry <- as.numeric(campus_inbound$site == "ferry")
campus_inbound$green_bridge <- as.numeric(campus_inbound$site == "green_bridge")
campus_inbound$lakes <- as.numeric(campus_inbound$site == "lakes")
campus_inbound$Macquarie <- as.numeric(campus_inbound$site == "Macquarie")
campus_inbound$McGregor <- as.numeric(campus_inbound$site == "McGregor")
campus_inbound$Schonell <- as.numeric(campus_inbound$site == "Schonell")
campus_inbound$uq <- as.numeric(campus_inbound$site == "uq")
campus_inbound$time2 <- campus_inbound$time
campus_inbound$time3 <- campus_inbound$time
campus_inbound$time4 <- campus_inbound$time
campus_inbound$time5 <- campus_inbound$time
campus_inbound$time6 <- campus_inbound$time
campus_inbound$time7 <- campus_inbound$time
campus_inbound$time8 <- campus_inbound$time
mod3 <- inla(count ~ site_type +
f(time, Chancellors, model = "rw1", hyper = hyper.prec) +
f(time2, ferry, model = "rw1", hyper = hyper.prec) +
f(time3, green_bridge, model = "rw1", hyper = hyper.prec) +
f(time4, lakes, model = "rw1", hyper = hyper.prec) +
f(time5, Macquarie, model = "rw1", hyper = hyper.prec) +
f(time6, McGregor, model = "rw1", hyper = hyper.prec) +
f(time7, Schonell, model = "rw1", hyper = hyper.prec) +
f(time8, uq, model = "rw1", hyper = hyper.prec),
family = "nbinomial",
control.compute = list(dic= TRUE, waic = TRUE),
data = campus_inbound)summary(mod3)
Call:
c("inla.core(formula = formula, family = family, contrasts = contrasts,
", " data = data, quantiles = quantiles, E = E, offset = offset, ", "
scale = scale, weights = weights, Ntrials = Ntrials, strata = strata,
", " lp.scale = lp.scale, link.covariates = link.covariates, verbose =
verbose, ", " lincomb = lincomb, selection = selection, control.compute
= control.compute, ", " control.predictor = control.predictor,
control.family = control.family, ", " control.inla = control.inla,
control.fixed = control.fixed, ", " control.mode = control.mode,
control.expert = control.expert, ", " control.hazard = control.hazard,
control.lincomb = control.lincomb, ", " control.update =
control.update, control.lp.scale = control.lp.scale, ", "
control.pardiso = control.pardiso, only.hyperparam = only.hyperparam,
", " inla.call = inla.call, inla.arg = inla.arg, num.threads =
num.threads, ", " blas.num.threads = blas.num.threads, keep = keep,
working.directory = working.directory, ", " silent = silent, inla.mode
= inla.mode, safe = FALSE, debug = debug, ", " .parent.frame =
.parent.frame)")
Time used:
Pre = 0.813, Running = 227, Post = 0.877, Total = 229
Fixed effects:
mean sd 0.025quant 0.5quant 0.975quant
(Intercept) 1.136 0.031 1.074 1.136 1.195
site_typecyclists Macquarie -0.737 0.070 -0.877 -0.735 -0.603
site_typepedestrians green_bridge 0.424 0.019 0.386 0.424 0.462
site_typepublic_transport ferry -1.149 0.116 -1.393 -1.143 -0.936
site_typepublic_transport lakes 0.060 0.106 -0.159 0.064 0.256
site_typepublic_transport uq 0.643 0.071 0.496 0.646 0.774
site_typevehicles Chancellors 1.413 0.035 1.345 1.412 1.483
site_typevehicles McGregor 2.128 0.033 2.063 2.127 2.194
site_typevehicles Schonell 2.872 0.033 2.809 2.872 2.938
mode kld
(Intercept) 1.137 0
site_typecyclists Macquarie -0.733 0
site_typepedestrians green_bridge 0.424 0
site_typepublic_transport ferry -1.133 0
site_typepublic_transport lakes 0.073 0
site_typepublic_transport uq 0.652 0
site_typevehicles Chancellors 1.412 0
site_typevehicles McGregor 2.127 0
site_typevehicles Schonell 2.871 0
Random effects:
Name Model
time RW1 model
time2 RW1 model
time3 RW1 model
time4 RW1 model
time5 RW1 model
time6 RW1 model
time7 RW1 model
time8 RW1 model
Model hyperparameters:
mean sd 0.025quant
size for the nbinomial observations (1/overdispersion) 62.286 9.741 45.409
Precision for time 0.124 0.013 0.099
Precision for time2 0.014 0.002 0.011
Precision for time3 0.077 0.007 0.063
Precision for time4 0.022 0.002 0.019
Precision for time5 0.070 0.009 0.055
Precision for time6 0.173 0.015 0.145
Precision for time7 0.124 0.010 0.106
Precision for time8 0.022 0.002 0.018
0.5quant 0.975quant
size for the nbinomial observations (1/overdispersion) 61.491 83.675
Precision for time 0.123 0.150
Precision for time2 0.014 0.018
Precision for time3 0.077 0.092
Precision for time4 0.022 0.026
Precision for time5 0.070 0.089
Precision for time6 0.172 0.204
Precision for time7 0.123 0.145
Precision for time8 0.022 0.026
mode
size for the nbinomial observations (1/overdispersion) 59.907
Precision for time 0.123
Precision for time2 0.014
Precision for time3 0.078
Precision for time4 0.022
Precision for time5 0.069
Precision for time6 0.171
Precision for time7 0.121
Precision for time8 0.021
Deviance Information Criterion (DIC) ...............: 33290.72
Deviance Information Criterion (DIC, saturated) ....: 28253.72
Effective number of parameters .....................: 2631.89
Watanabe-Akaike information criterion (WAIC) ...: 33342.30
Effective number of parameters .................: 2046.59
Marginal log-Likelihood: -31170.50
is computed
Posterior summaries for the linear predictor and the fitted values are computed
(Posterior marginals needs also 'control.compute=list(return.marginals.predictor=TRUE)')
autoplot(mod3)P3 <- bind_cols(time = campus_inbound$time, count = campus_inbound$count, site_type = campus_inbound$site_type,
fit = mod3$summary.fitted.values$`0.5quant`,
lci = mod3$summary.fitted.values$`0.025quant`,
uci = mod3$summary.fitted.values$`0.975quant`)
ggplot(P3, aes(x = time)) +
geom_line(aes(y = count), colour = "orange", alpha = 0.5) +
geom_line(aes(y = fit), col = "purple") +
geom_ribbon(aes(ymin = lci, ymax = uci), alpha = 0.3) +
facet_wrap(~site_type) +
theme_minimal() + xlab("") P3 %>%
filter(site_type == "public_transport lakes") %>%
ggplot(aes(x = time)) +
geom_point(aes(y = count), colour = "orange", size = 2, alpha = 0.5) +
geom_line(aes(y = fit), col = "purple") +
facet_wrap(~site_type) +
theme_minimal() + xlab("") ggplot(P3, aes(x = count, y = fit)) +
geom_point(alpha = 0.5) +
facet_wrap(~site_type) +
theme_minimal() + xlab("Counts") + ylab("fitted")campus_inbound$cyclists_green_bridge <- as.numeric(campus_inbound$site_type == "cyclists green_bridge")
campus_inbound$cyclists_Macquarie <- as.numeric(campus_inbound$site_type == "cyclists Macquarie")
campus_inbound$pedestrians_green_bridge <- as.numeric(campus_inbound$site_type == "pedestrians green_bridge")
campus_inbound$public_transport_ferry <- as.numeric(campus_inbound$site_type == "public_transport ferry")
campus_inbound$public_transport_lakes <- as.numeric(campus_inbound$site_type == "public_transport lakes")
campus_inbound$public_transport_uq <- as.numeric(campus_inbound$site_type == "public_transport uq")
campus_inbound$vehicles_Chancellors <- as.numeric(campus_inbound$site_type == "vehicles Chancellors")
campus_inbound$vehicles_McGregor <- as.numeric(campus_inbound$site_type == "vehicles McGregor")
campus_inbound$vehicles_Schonell <- as.numeric(campus_inbound$site_type == "vehicles Schonell")
campus_inbound$time9 <- campus_inbound$time
mod4 <- inla(count ~ site_type +
f(time, cyclists_green_bridge, model = "rw1", hyper = hyper.prec) +
f(time2, cyclists_Macquarie, model = "rw1", hyper = hyper.prec) +
f(time3, pedestrians_green_bridge, model = "rw1", hyper = hyper.prec) +
f(time4, public_transport_ferry, model = "rw1", hyper = hyper.prec) +
f(time5, public_transport_lakes, model = "rw1", hyper = hyper.prec) +
f(time6, public_transport_uq, model = "rw1", hyper = hyper.prec) +
f(time7, vehicles_Chancellors, model = "rw1", hyper = hyper.prec) +
f(time8, vehicles_McGregor, model = "rw1", hyper = hyper.prec) +
f(time9, vehicles_Schonell, model = "rw1", hyper = hyper.prec),
family = "nbinomial",
control.compute = list(dic= TRUE, waic = TRUE),
data = campus_inbound)
*** inla.core.safe: rerun to try to solve negative eigenvalue(s) in the Hessian
summary(mod4)
Call:
c("inla.core(formula = formula, family = family, contrasts = contrasts,
", " data = data, quantiles = quantiles, E = E, offset = offset, ", "
scale = scale, weights = weights, Ntrials = Ntrials, strata = strata,
", " lp.scale = lp.scale, link.covariates = link.covariates, verbose =
verbose, ", " lincomb = lincomb, selection = selection, control.compute
= control.compute, ", " control.predictor = control.predictor,
control.family = control.family, ", " control.inla = control.inla,
control.fixed = control.fixed, ", " control.mode = control.mode,
control.expert = control.expert, ", " control.hazard = control.hazard,
control.lincomb = control.lincomb, ", " control.update =
control.update, control.lp.scale = control.lp.scale, ", "
control.pardiso = control.pardiso, only.hyperparam = only.hyperparam,
", " inla.call = inla.call, inla.arg = inla.arg, num.threads =
num.threads, ", " blas.num.threads = blas.num.threads, keep = keep,
working.directory = working.directory, ", " silent = silent, inla.mode
= inla.mode, safe = FALSE, debug = debug, ", " .parent.frame =
.parent.frame)")
Time used:
Pre = 1.11, Running = 174, Post = 0.811, Total = 176
Fixed effects:
mean sd 0.025quant 0.5quant 0.975quant
(Intercept) 1.093 0.039 1.015 1.094 1.168
site_typecyclists Macquarie -0.694 0.066 -0.826 -0.694 -0.566
site_typepedestrians green_bridge 0.476 0.051 0.376 0.476 0.576
site_typepublic_transport ferry -24.335 0.817 -149.205 -24.337 100.530
site_typepublic_transport lakes 13.402 1.193 -169.009 13.387 14607.265
site_typepublic_transport uq 0.658 0.072 0.510 0.661 0.793
site_typevehicles Chancellors 1.447 0.042 1.367 1.447 1.531
site_typevehicles McGregor 2.165 0.040 2.088 2.165 2.246
site_typevehicles Schonell 2.908 0.040 2.832 2.908 2.989
mode kld
(Intercept) 1.095 0.0
site_typecyclists Macquarie -0.693 0.0
site_typepedestrians green_bridge 0.476 0.0
site_typepublic_transport ferry 19.372 1762665.3
site_typepublic_transport lakes -18.514 440768.6
site_typepublic_transport uq 0.666 0.0
site_typevehicles Chancellors 1.446 0.0
site_typevehicles McGregor 2.164 0.0
site_typevehicles Schonell 2.906 0.0
Random effects:
Name Model
time RW1 model
time2 RW1 model
time3 RW1 model
time4 RW1 model
time5 RW1 model
time6 RW1 model
time7 RW1 model
time8 RW1 model
time9 RW1 model
Model hyperparameters:
mean sd
size for the nbinomial observations (1/overdispersion) 1277.041 4.281
Precision for time 0.069 0.000
Precision for time2 0.071 0.000
Precision for time3 0.065 0.001
Precision for time4 Inf NaN
Precision for time5 0.020 0.000
Precision for time6 0.020 0.000
Precision for time7 0.112 0.000
Precision for time8 0.167 0.000
Precision for time9 0.117 0.000
0.025quant 0.5quant
size for the nbinomial observations (1/overdispersion) 1268.636 1277.032
Precision for time 0.068 0.069
Precision for time2 0.070 0.071
Precision for time3 0.064 0.065
Precision for time4 0.000 0.000
Precision for time5 0.020 0.020
Precision for time6 0.020 0.020
Precision for time7 0.111 0.112
Precision for time8 0.167 0.167
Precision for time9 0.117 0.117
0.975quant mode
size for the nbinomial observations (1/overdispersion) 1285.567 1277.020
Precision for time 0.069 0.069
Precision for time2 0.071 0.071
Precision for time3 0.065 0.065
Precision for time4 Inf NaN
Precision for time5 0.020 0.020
Precision for time6 0.020 0.020
Precision for time7 0.112 0.112
Precision for time8 0.167 0.167
Precision for time9 0.117 0.117
Deviance Information Criterion (DIC) ...............: 31620.84
Deviance Information Criterion (DIC, saturated) ....: 26583.83
Effective number of parameters .....................: 3135.36
Watanabe-Akaike information criterion (WAIC) ...: 31782.34
Effective number of parameters .................: 2381.44
Marginal log-Likelihood: -32647.37
is computed
Posterior summaries for the linear predictor and the fitted values are computed
(Posterior marginals needs also 'control.compute=list(return.marginals.predictor=TRUE)')
autoplot(mod4)P4 <- bind_cols(time = campus_inbound$time, count = campus_inbound$count, site_type = campus_inbound$site_type,
fit = mod4$summary.fitted.values$`0.5quant`,
lci = mod4$summary.fitted.values$`0.025quant`,
uci = mod4$summary.fitted.values$`0.975quant`)
ggplot(P4, aes(x = time)) +
geom_line(aes(y = count), colour = "orange", alpha = 0.5) +
geom_line(aes(y = fit), col = "purple") +
geom_ribbon(aes(ymin = lci, ymax = uci), alpha = 0.3) +
facet_wrap(~site_type) +
theme_minimal() + xlab("") P4 %>%
filter(site_type == "public_transport lakes") %>%
ggplot(aes(x = time)) +
geom_point(aes(y = count), colour = "orange", size = 2, alpha = 0.5) +
geom_line(aes(y = fit), col = "purple") +
facet_wrap(~site_type) +
theme_minimal() + xlab("") ggplot(P4, aes(x = count, y = fit)) +
geom_point(alpha = 0.5) +
facet_wrap(~site_type) +
theme_minimal() + xlab("Counts") + ylab("fitted")mod5 <- inla(count ~ site_type +
f(time, model = "rw2", scale.model = TRUE, hyper = hyper.prec),
family = "nbinomial",
control.compute = list(dic= TRUE, waic = TRUE),
data = campus_inbound)summary(mod5)
Call:
c("inla.core(formula = formula, family = family, contrasts = contrasts,
", " data = data, quantiles = quantiles, E = E, offset = offset, ", "
scale = scale, weights = weights, Ntrials = Ntrials, strata = strata,
", " lp.scale = lp.scale, link.covariates = link.covariates, verbose =
verbose, ", " lincomb = lincomb, selection = selection, control.compute
= control.compute, ", " control.predictor = control.predictor,
control.family = control.family, ", " control.inla = control.inla,
control.fixed = control.fixed, ", " control.mode = control.mode,
control.expert = control.expert, ", " control.hazard = control.hazard,
control.lincomb = control.lincomb, ", " control.update =
control.update, control.lp.scale = control.lp.scale, ", "
control.pardiso = control.pardiso, only.hyperparam = only.hyperparam,
", " inla.call = inla.call, inla.arg = inla.arg, num.threads =
num.threads, ", " blas.num.threads = blas.num.threads, keep = keep,
working.directory = working.directory, ", " silent = silent, inla.mode
= inla.mode, safe = FALSE, debug = debug, ", " .parent.frame =
.parent.frame)")
Time used:
Pre = 0.63, Running = 40.5, Post = 0.279, Total = 41.4
Fixed effects:
mean sd 0.025quant 0.5quant 0.975quant
(Intercept) 1.617 0.040 1.539 1.617 1.696
site_typecyclists Macquarie -0.610 0.058 -0.723 -0.610 -0.496
site_typepedestrians green_bridge 0.352 0.055 0.244 0.352 0.461
site_typepublic_transport ferry -0.495 0.058 -0.608 -0.495 -0.381
site_typepublic_transport lakes 1.518 0.054 1.411 1.518 1.624
site_typepublic_transport uq 1.243 0.054 1.137 1.243 1.350
site_typevehicles Chancellors 1.193 0.056 1.084 1.193 1.303
site_typevehicles McGregor 1.859 0.055 1.751 1.859 1.966
site_typevehicles Schonell 2.632 0.054 2.527 2.632 2.737
mode kld
(Intercept) 1.617 0
site_typecyclists Macquarie -0.610 0
site_typepedestrians green_bridge 0.352 0
site_typepublic_transport ferry -0.495 0
site_typepublic_transport lakes 1.518 0
site_typepublic_transport uq 1.243 0
site_typevehicles Chancellors 1.193 0
site_typevehicles McGregor 1.859 0
site_typevehicles Schonell 2.632 0
Random effects:
Name Model
time RW2 model
Model hyperparameters:
mean sd 0.025quant
size for the nbinomial observations (1/overdispersion) 1.079 0.022 1.04
Precision for time 0.192 0.001 0.19
0.5quant 0.975quant
size for the nbinomial observations (1/overdispersion) 1.077 1.127
Precision for time 0.192 0.194
mode
size for the nbinomial observations (1/overdispersion) 1.068
Precision for time 0.193
Deviance Information Criterion (DIC) ...............: 42947.05
Deviance Information Criterion (DIC, saturated) ....: 37910.02
Effective number of parameters .....................: 18.54
Watanabe-Akaike information criterion (WAIC) ...: 42965.30
Effective number of parameters .................: 36.21
Marginal log-Likelihood: -26803.97
is computed
Posterior summaries for the linear predictor and the fitted values are computed
(Posterior marginals needs also 'control.compute=list(return.marginals.predictor=TRUE)')
autoplot(mod5)P5 <- bind_cols(time = campus_inbound$time, count = campus_inbound$count, site_type = campus_inbound$site_type,
fit = mod5$summary.fitted.values$`0.5quant`,
lci = mod5$summary.fitted.values$`0.025quant`,
uci = mod5$summary.fitted.values$`0.975quant`)
ggplot(P5, aes(x = time)) +
geom_line(aes(y = count), colour = "orange", alpha = 0.5) +
geom_line(aes(y = fit), col = "purple") +
geom_ribbon(aes(ymin = lci, ymax = uci), alpha = 0.3) +
facet_wrap(~site_type) +
theme_minimal() + xlab("") P5 %>%
filter(site_type == "public_transport lakes") %>%
ggplot(aes(x = time)) +
geom_point(aes(y = count), colour = "orange", size = 2, alpha = 0.5) +
geom_line(aes(y = fit), col = "purple") +
facet_wrap(~site_type) +
theme_minimal() + xlab("") ggplot(P5, aes(x = count, y = fit)) +
geom_point(alpha = 0.5) +
facet_wrap(~site_type) +
theme_minimal() + xlab("Counts") + ylab("fitted") inla.setOption(scale.model.default = TRUE)
campus_inbound$cyclists <- as.numeric(campus_inbound$type == "cyclists")
campus_inbound$pedestrians <- as.numeric(campus_inbound$type == "pedestrians")
campus_inbound$public_transport <- as.numeric(campus_inbound$type == "public_transport")
campus_inbound$vehicles <- as.numeric(campus_inbound$type == "vehicles")
campus_inbound$time2 <- campus_inbound$time
campus_inbound$time3 <- campus_inbound$time
campus_inbound$time4 <- campus_inbound$time
mod6 <- inla(count ~ site_type +
f(time, cyclists, model = "rw2", hyper = hyper.prec) +
f(time2, pedestrians, model = "rw2", hyper = hyper.prec) +
f(time3, public_transport, model = "rw2", hyper = hyper.prec) +
f(time4, vehicles, model = "rw2", hyper = hyper.prec),
family = "nbinomial",
control.compute = list(dic= TRUE, waic = TRUE),
data = campus_inbound)summary(mod6)
Call:
c("inla.core(formula = formula, family = family, contrasts = contrasts,
", " data = data, quantiles = quantiles, E = E, offset = offset, ", "
scale = scale, weights = weights, Ntrials = Ntrials, strata = strata,
", " lp.scale = lp.scale, link.covariates = link.covariates, verbose =
verbose, ", " lincomb = lincomb, selection = selection, control.compute
= control.compute, ", " control.predictor = control.predictor,
control.family = control.family, ", " control.inla = control.inla,
control.fixed = control.fixed, ", " control.mode = control.mode,
control.expert = control.expert, ", " control.hazard = control.hazard,
control.lincomb = control.lincomb, ", " control.update =
control.update, control.lp.scale = control.lp.scale, ", "
control.pardiso = control.pardiso, only.hyperparam = only.hyperparam,
", " inla.call = inla.call, inla.arg = inla.arg, num.threads =
num.threads, ", " blas.num.threads = blas.num.threads, keep = keep,
working.directory = working.directory, ", " silent = silent, inla.mode
= inla.mode, safe = FALSE, debug = debug, ", " .parent.frame =
.parent.frame)")
Time used:
Pre = 0.657, Running = 147, Post = 0.446, Total = 148
Fixed effects:
mean sd 0.025quant 0.5quant 0.975quant
(Intercept) 2.208 0.032 2.145 2.208 2.272
site_typecyclists Macquarie -0.660 0.047 -0.752 -0.660 -0.567
site_typepedestrians green_bridge -0.513 0.055 -0.621 -0.513 -0.407
site_typepublic_transport ferry -2.316 0.093 -2.500 -2.315 -2.136
site_typepublic_transport lakes -0.446 0.088 -0.622 -0.445 -0.275
site_typepublic_transport uq -0.531 0.088 -0.706 -0.530 -0.360
site_typevehicles Chancellors 0.429 0.046 0.339 0.429 0.520
site_typevehicles McGregor 1.096 0.045 1.007 1.096 1.184
site_typevehicles Schonell 1.937 0.045 1.849 1.937 2.024
mode kld
(Intercept) 2.208 0
site_typecyclists Macquarie -0.660 0
site_typepedestrians green_bridge -0.513 0
site_typepublic_transport ferry -2.313 0
site_typepublic_transport lakes -0.443 0
site_typepublic_transport uq -0.528 0
site_typevehicles Chancellors 0.429 0
site_typevehicles McGregor 1.096 0
site_typevehicles Schonell 1.937 0
Random effects:
Name Model
time RW2 model
time2 RW2 model
time3 RW2 model
time4 RW2 model
Model hyperparameters:
mean sd
size for the nbinomial observations (1/overdispersion) 1.708 0.009
Precision for time 30156957.349 94383.073
Precision for time2 0.003 0.000
Precision for time3 0.001 0.000
Precision for time4 0.002 0.000
0.025quant
size for the nbinomial observations (1/overdispersion) 1.687
Precision for time 30031322.355
Precision for time2 0.003
Precision for time3 0.001
Precision for time4 0.002
0.5quant
size for the nbinomial observations (1/overdispersion) 1.709
Precision for time 30138116.495
Precision for time2 0.003
Precision for time3 0.001
Precision for time4 0.002
0.975quant
size for the nbinomial observations (1/overdispersion) 1.719
Precision for time 30382841.968
Precision for time2 0.003
Precision for time3 0.001
Precision for time4 0.002
mode
size for the nbinomial observations (1/overdispersion) 1.718
Precision for time 30047468.464
Precision for time2 0.003
Precision for time3 0.001
Precision for time4 0.002
Deviance Information Criterion (DIC) ...............: 41142.91
Deviance Information Criterion (DIC, saturated) ....: 36105.89
Effective number of parameters .....................: 175.91
Watanabe-Akaike information criterion (WAIC) ...: 41104.82
Effective number of parameters .................: 129.23
Marginal log-Likelihood: -39066.93
is computed
Posterior summaries for the linear predictor and the fitted values are computed
(Posterior marginals needs also 'control.compute=list(return.marginals.predictor=TRUE)')
autoplot(mod6)P6 <- bind_cols(time = campus_inbound$time, count = campus_inbound$count, site_type = campus_inbound$site_type,
fit = mod6$summary.fitted.values$`0.5quant`,
lci = mod6$summary.fitted.values$`0.025quant`,
uci = mod6$summary.fitted.values$`0.975quant`)
ggplot(P6, aes(x = time)) +
geom_line(aes(y = count), colour = "orange", alpha = 0.5) +
geom_line(aes(y = fit), col = "purple") +
geom_ribbon(aes(ymin = lci, ymax = uci), alpha = 0.3) +
facet_wrap(~site_type) +
theme_minimal() + xlab("") P6 %>%
filter(site_type == "public_transport lakes") %>%
ggplot(aes(x = time)) +
geom_point(aes(y = count), colour = "orange", size = 2, alpha = 0.5) +
geom_line(aes(y = fit), col = "purple") +
facet_wrap(~site_type) +
theme_minimal() + xlab("") ggplot(P6, aes(x = count, y = fit)) +
geom_point(alpha = 0.5) +
facet_wrap(~site_type) +
theme_minimal() + xlab("Counts") + ylab("fitted")campus_inbound$Chancellors <- as.numeric(campus_inbound$site == "Chancellors")
campus_inbound$ferry <- as.numeric(campus_inbound$site == "ferry")
campus_inbound$green_bridge <- as.numeric(campus_inbound$site == "green_bridge")
campus_inbound$lakes <- as.numeric(campus_inbound$site == "lakes")
campus_inbound$Macquarie <- as.numeric(campus_inbound$site == "Macquarie")
campus_inbound$McGregor <- as.numeric(campus_inbound$site == "McGregor")
campus_inbound$Schonell <- as.numeric(campus_inbound$site == "Schonell")
campus_inbound$uq <- as.numeric(campus_inbound$site == "uq")
campus_inbound$time2 <- campus_inbound$time
campus_inbound$time3 <- campus_inbound$time
campus_inbound$time4 <- campus_inbound$time
campus_inbound$time5 <- campus_inbound$time
campus_inbound$time6 <- campus_inbound$time
campus_inbound$time7 <- campus_inbound$time
campus_inbound$time8 <- campus_inbound$time
mod7 <- inla(count ~ site_type +
f(time, Chancellors, model = "rw2", hyper = hyper.prec) +
f(time2, ferry, model = "rw2", hyper = hyper.prec) +
f(time3, green_bridge, model = "rw2", hyper = hyper.prec) +
f(time4, lakes, model = "rw2", hyper = hyper.prec) +
f(time5, Macquarie, model = "rw2", hyper = hyper.prec) +
f(time6, McGregor, model = "rw2", hyper = hyper.prec) +
f(time7, Schonell, model = "rw2", hyper = hyper.prec) +
f(time8, uq, model = "rw2", hyper = hyper.prec),
family = "nbinomial",
control.compute = list(dic= TRUE, waic = TRUE),
data = campus_inbound)summary(mod7)
Call:
c("inla.core(formula = formula, family = family, contrasts = contrasts,
", " data = data, quantiles = quantiles, E = E, offset = offset, ", "
scale = scale, weights = weights, Ntrials = Ntrials, strata = strata,
", " lp.scale = lp.scale, link.covariates = link.covariates, verbose =
verbose, ", " lincomb = lincomb, selection = selection, control.compute
= control.compute, ", " control.predictor = control.predictor,
control.family = control.family, ", " control.inla = control.inla,
control.fixed = control.fixed, ", " control.mode = control.mode,
control.expert = control.expert, ", " control.hazard = control.hazard,
control.lincomb = control.lincomb, ", " control.update =
control.update, control.lp.scale = control.lp.scale, ", "
control.pardiso = control.pardiso, only.hyperparam = only.hyperparam,
", " inla.call = inla.call, inla.arg = inla.arg, num.threads =
num.threads, ", " blas.num.threads = blas.num.threads, keep = keep,
working.directory = working.directory, ", " silent = silent, inla.mode
= inla.mode, safe = FALSE, debug = debug, ", " .parent.frame =
.parent.frame)")
Time used:
Pre = 0.986, Running = 45.2, Post = 0.933, Total = 47.1
Fixed effects:
mean sd 0.025quant 0.5quant 0.975quant
(Intercept) 1.155 0.036 1.082 1.156 1.225
site_typecyclists Macquarie -0.699 0.069 -0.836 -0.699 -0.567
site_typepedestrians green_bridge 0.449 0.030 0.390 0.449 0.508
site_typepublic_transport ferry -0.566 0.078 -0.724 -0.565 -0.416
site_typepublic_transport lakes 0.008 0.119 -0.232 0.010 0.236
site_typepublic_transport uq 0.736 0.083 0.571 0.738 0.896
site_typevehicles Chancellors 1.459 0.041 1.379 1.458 1.541
site_typevehicles McGregor 2.133 0.040 2.056 2.133 2.214
site_typevehicles Schonell 2.897 0.040 2.820 2.896 2.976
mode kld
(Intercept) 1.157 0
site_typecyclists Macquarie -0.697 0
site_typepedestrians green_bridge 0.449 0
site_typepublic_transport ferry -0.562 0
site_typepublic_transport lakes 0.014 0
site_typepublic_transport uq 0.740 0
site_typevehicles Chancellors 1.458 0
site_typevehicles McGregor 2.132 0
site_typevehicles Schonell 2.895 0
Random effects:
Name Model
time RW2 model
time2 RW2 model
time3 RW2 model
time4 RW2 model
time5 RW2 model
time6 RW2 model
time7 RW2 model
time8 RW2 model
Model hyperparameters:
mean sd 0.025quant
size for the nbinomial observations (1/overdispersion) 8.282 0.243 7.905
Precision for time 0.003 0.000 0.002
Precision for time2 0.002 0.000 0.001
Precision for time3 0.002 0.000 0.001
Precision for time4 0.001 0.000 0.000
Precision for time5 0.002 0.000 0.001
Precision for time6 0.002 0.000 0.001
Precision for time7 0.002 0.000 0.001
Precision for time8 0.001 0.000 0.001
0.5quant 0.975quant
size for the nbinomial observations (1/overdispersion) 8.246 8.840
Precision for time 0.003 0.004
Precision for time2 0.002 0.002
Precision for time3 0.002 0.002
Precision for time4 0.001 0.001
Precision for time5 0.002 0.002
Precision for time6 0.002 0.002
Precision for time7 0.002 0.002
Precision for time8 0.001 0.001
mode
size for the nbinomial observations (1/overdispersion) 8.116
Precision for time 0.003
Precision for time2 0.001
Precision for time3 0.002
Precision for time4 0.001
Precision for time5 0.002
Precision for time6 0.002
Precision for time7 0.002
Precision for time8 0.001
Deviance Information Criterion (DIC) ...............: 35700.90
Deviance Information Criterion (DIC, saturated) ....: 30663.89
Effective number of parameters .....................: 503.22
Watanabe-Akaike information criterion (WAIC) ...: 35794.89
Effective number of parameters .................: 539.93
Marginal log-Likelihood: -55390.86
is computed
Posterior summaries for the linear predictor and the fitted values are computed
(Posterior marginals needs also 'control.compute=list(return.marginals.predictor=TRUE)')
autoplot(mod7)P7 <- bind_cols(time = campus_inbound$time, count = campus_inbound$count, site_type = campus_inbound$site_type,
fit = mod7$summary.fitted.values$`0.5quant`,
lci = mod7$summary.fitted.values$`0.025quant`,
uci = mod7$summary.fitted.values$`0.975quant`)
ggplot(P7, aes(x = time)) +
geom_line(aes(y = count), colour = "orange", alpha = 0.5) +
geom_line(aes(y = fit), col = "purple") +
geom_ribbon(aes(ymin = lci, ymax = uci), alpha = 0.3) +
facet_wrap(~site_type) +
theme_minimal() + xlab("") P7 %>%
filter(site_type == "public_transport lakes") %>%
ggplot(aes(x = time)) +
geom_point(aes(y = count), colour = "orange", size = 2, alpha = 0.5) +
geom_line(aes(y = fit), col = "purple") +
facet_wrap(~site_type) +
theme_minimal() + xlab("") ggplot(P7, aes(x = count, y = fit)) +
geom_point(alpha = 0.5) +
facet_wrap(~site_type) +
theme_minimal() + xlab("Counts") + ylab("fitted")campus_inbound$cyclists_green_bridge <- as.numeric(campus_inbound$site_type == "cyclists green_bridge")
campus_inbound$cyclists_Macquarie <- as.numeric(campus_inbound$site_type == "cyclists Macquarie")
campus_inbound$pedestrians_green_bridge <- as.numeric(campus_inbound$site_type == "pedestrians green_bridge")
campus_inbound$public_transport_ferry <- as.numeric(campus_inbound$site_type == "public_transport ferry")
campus_inbound$public_transport_lakes <- as.numeric(campus_inbound$site_type == "public_transport lakes")
campus_inbound$public_transport_uq <- as.numeric(campus_inbound$site_type == "public_transport uq")
campus_inbound$vehicles_Chancellors <- as.numeric(campus_inbound$site_type == "vehicles Chancellors")
campus_inbound$vehicles_McGregor <- as.numeric(campus_inbound$site_type == "vehicles McGregor")
campus_inbound$vehicles_Schonell <- as.numeric(campus_inbound$site_type == "vehicles Schonell")
campus_inbound$time9 <- campus_inbound$time
mod8 <- inla(count ~ site_type +
f(time, cyclists_green_bridge, model = "rw2", hyper = hyper.prec) +
f(time2, cyclists_Macquarie, model = "rw2", hyper = hyper.prec) +
f(time3, pedestrians_green_bridge, model = "rw2", hyper = hyper.prec) +
f(time4, public_transport_ferry, model = "rw2", hyper = hyper.prec) +
f(time5, public_transport_lakes, model = "rw2", hyper = hyper.prec) +
f(time6, public_transport_uq, model = "rw2", hyper = hyper.prec) +
f(time7, vehicles_Chancellors, model = "rw2", hyper = hyper.prec) +
f(time8, vehicles_McGregor, model = "rw2", hyper = hyper.prec) +
f(time9, vehicles_Schonell, model = "rw2", hyper = hyper.prec),
family = "nbinomial",
control.compute = list(dic= TRUE, waic = TRUE),
data = campus_inbound)summary(mod8)
Call:
c("inla.core(formula = formula, family = family, contrasts = contrasts,
", " data = data, quantiles = quantiles, E = E, offset = offset, ", "
scale = scale, weights = weights, Ntrials = Ntrials, strata = strata,
", " lp.scale = lp.scale, link.covariates = link.covariates, verbose =
verbose, ", " lincomb = lincomb, selection = selection, control.compute
= control.compute, ", " control.predictor = control.predictor,
control.family = control.family, ", " control.inla = control.inla,
control.fixed = control.fixed, ", " control.mode = control.mode,
control.expert = control.expert, ", " control.hazard = control.hazard,
control.lincomb = control.lincomb, ", " control.update =
control.update, control.lp.scale = control.lp.scale, ", "
control.pardiso = control.pardiso, only.hyperparam = only.hyperparam,
", " inla.call = inla.call, inla.arg = inla.arg, num.threads =
num.threads, ", " blas.num.threads = blas.num.threads, keep = keep,
working.directory = working.directory, ", " silent = silent, inla.mode
= inla.mode, safe = FALSE, debug = debug, ", " .parent.frame =
.parent.frame)")
Time used:
Pre = 0.857, Running = 48.6, Post = 0.75, Total = 50.2
Fixed effects:
mean sd 0.025quant 0.5quant 0.975quant
(Intercept) 1.166 0.044 1.077 1.166 1.249
site_typecyclists Macquarie -0.708 0.076 -0.860 -0.708 -0.561
site_typepedestrians green_bridge 0.474 0.058 0.360 0.473 0.588
site_typepublic_transport ferry -0.580 0.084 -0.750 -0.579 -0.418
site_typepublic_transport lakes -0.014 0.126 -0.268 -0.012 0.225
site_typepublic_transport uq 1.839 0.023 -1.656 1.839 5.333
site_typevehicles Chancellors 1.447 0.048 1.355 1.447 1.544
site_typevehicles McGregor 2.122 0.047 2.032 2.122 2.217
site_typevehicles Schonell 2.885 0.047 2.796 2.884 2.979
mode kld
(Intercept) 1.168 0
site_typecyclists Macquarie -0.706 0
site_typepedestrians green_bridge 0.473 0
site_typepublic_transport ferry -0.576 0
site_typepublic_transport lakes -0.007 0
site_typepublic_transport uq 3.062 1762665
site_typevehicles Chancellors 1.445 0
site_typevehicles McGregor 2.120 0
site_typevehicles Schonell 2.883 0
Random effects:
Name Model
time RW2 model
time2 RW2 model
time3 RW2 model
time4 RW2 model
time5 RW2 model
time6 RW2 model
time7 RW2 model
time8 RW2 model
time9 RW2 model
Model hyperparameters:
mean sd 0.025quant
size for the nbinomial observations (1/overdispersion) 8.689 0.349 8.025
Precision for time 0.002 0.000 0.002
Precision for time2 0.002 0.000 0.001
Precision for time3 0.002 0.000 0.002
Precision for time4 0.002 0.000 0.001
Precision for time5 0.001 0.000 0.000
Precision for time6 0.001 0.000 0.001
Precision for time7 0.003 0.000 0.002
Precision for time8 0.002 0.000 0.001
Precision for time9 0.002 0.000 0.001
0.5quant 0.975quant
size for the nbinomial observations (1/overdispersion) 8.682 9.397
Precision for time 0.002 0.003
Precision for time2 0.002 0.002
Precision for time3 0.002 0.003
Precision for time4 0.001 0.002
Precision for time5 0.001 0.001
Precision for time6 0.001 0.001
Precision for time7 0.003 0.004
Precision for time8 0.002 0.002
Precision for time9 0.002 0.002
mode
size for the nbinomial observations (1/overdispersion) 8.666
Precision for time 0.002
Precision for time2 0.002
Precision for time3 0.002
Precision for time4 0.001
Precision for time5 0.001
Precision for time6 0.001
Precision for time7 0.003
Precision for time8 0.002
Precision for time9 0.002
Deviance Information Criterion (DIC) ...............: 35572.69
Deviance Information Criterion (DIC, saturated) ....: 30535.68
Effective number of parameters .....................: 551.47
Watanabe-Akaike information criterion (WAIC) ...: 35670.84
Effective number of parameters .................: 585.48
Marginal log-Likelihood: -59944.57
is computed
Posterior summaries for the linear predictor and the fitted values are computed
(Posterior marginals needs also 'control.compute=list(return.marginals.predictor=TRUE)')
autoplot(mod8)P8 <- bind_cols(time = campus_inbound$time, count = campus_inbound$count, site_type = campus_inbound$site_type,
fit = mod8$summary.fitted.values$`0.5quant`,
lci = mod8$summary.fitted.values$`0.025quant`,
uci = mod8$summary.fitted.values$`0.975quant`)
ggplot(P8, aes(x = time)) +
geom_line(aes(y = count), colour = "orange", alpha = 0.5) +
geom_line(aes(y = fit), col = "purple") +
geom_ribbon(aes(ymin = lci, ymax = uci), alpha = 0.3) +
facet_wrap(~site_type) +
theme_minimal() + xlab("") P8 %>%
filter(site_type == "public_transport lakes") %>%
ggplot(aes(x = time)) +
geom_point(aes(y = count), colour = "orange", size = 2, alpha = 0.5) +
geom_line(aes(y = fit), col = "purple") +
facet_wrap(~site_type) +
theme_minimal() + xlab("") ggplot(P8, aes(x = count, y = fit)) +
geom_point(alpha = 0.5) +
facet_wrap(~site_type) +
theme_minimal() + xlab("Counts") + ylab("fitted")dotchart(c(mod1$dic$dic, mod2$dic$dic, mod3$dic$dic, mod4$dic$dic,
mod5$dic$dic, mod6$dic$dic, mod7$dic$dic, mod8$dic$dic),
labels = c("mod1", "mod2", "mod3", "mod4", "mod5", "mod6", "mod7", "mod8"), main = "DIC")dotchart(c(mod1$waic$waic, mod2$waic$waic, mod3$waic$waic, mod4$waic$waic,
mod5$waic$waic, mod6$waic$waic, mod7$waic$waic, mod8$waic$waic),
labels = c("mod1", "mod2", "mod3", "mod4", "mod5", "mod6", "mod7", "mod8"), main = "WAIC")